<template>
    <div class="single">
        <!-- 歌曲列表标题栏 -->
        <songListRow></songListRow>
        <!-- 单条歌曲组件 -->
        <songline :col="index" :music="item" :index="index" v-for="(item, index) of PlayHistory" :key="index"></songline>
    </div>
</template>

<script>
import songListRow from '@/components/songListRow.vue'
import songline from "@/components/songline.vue"
import { url } from "@/apiUrl"//引入地址
import { mapState } from 'vuex';
export default {
    components: {
        songline,
        songListRow
    },
    computed: {
    ...mapState({
        PlayHistory: state => state.PlayHistory,
    }),
  },
    mounted(){
        this.$axios.post(`${url}/users/getUserData`,{
        t: localStorage["qtUser"]
      })
        .then(res=>{
            if (typeof res.data.data.PlayHistory != "undefined") {
            console.log(`历史记录`,res.data.data.PlayHistory);
            this.$store.commit("getPlayHistory",res.data.data.PlayHistory)
          }
        }).catch(()=>{})
    }
}
</script>

<style></style>